;(function () {
    _AJAX({
        url: AJAX_URL_USER + "api/sys/sysMenu/current",
        type: 'get',
        contentType: "application/json",
        dataType: 'json',
        success: function (data) {
            var datalist = data.data[0].children;
            var html = '';
            for (var i in datalist) {
            	if(datalist[i].children.length > 0) {
	                html += '<li>' +
	                    '<a href="#">' +
	                    '<i class="' + datalist[i].icon + '"></i>' +
	                    '<span class="nav-label">' + datalist[i].text + '</span>' +
	                    '<span class="fa arrow"></span>' +
	                    '</a>' +
	                    '<ul class="nav nav-second-level">';
            	}
            	else {
	                html += '<li id="homepage">' +
	                    '<a class="J_menuItem" href="' + datalist[i].href + '">'+
	                    '<i class="' + datalist[i].icon + '"></i>'+
	                    '<span class="nav-label">' + datalist[i].text + '</span></a>';
            	}
                for (var j in datalist[i].children) {
                    html += '<li>';
                    if (datalist[i].children[j].children.length != 0) {
                        html += '<a href="#">' + datalist[i].children[j].text + '<span class="fa arrow"></span></a>'
                    } else {
                        html += '<a class="J_menuItem" href="' + datalist[i].children[j].href + '">' + datalist[i].children[j].text + '</a>'
                    }
                    html += '<ul class="nav nav-third-level" aria-expanded="true" style="">';
                    for (var n in datalist[i].children[j].children) {
                        html += '<li><a class="J_menuItem" href="' + datalist[i].children[j].children[n].href + '" data-index="5">' + datalist[i].children[j].children[n].text + '</a></li>'
                    }
                    html += '</ul>' +
                        '</li>'
                }
                html += '</ul>' +
                    '</li>';
            }
            $('#side-menu').append(html);
            inithplus();
            contabsinit();
        }
    });
    
    
    _AJAX({
        url: AJAX_URL_USER + "api/sys/sysUser/select",
        type: 'get',
        contentType: "application/json",
        dataType: 'json',
        success: function (data) {
        	$("#nickname").text(data.data.userName);
        	$("#headImgUrl").attr("src", data.data.headimgurl);
        	$("#roleName").text(data.data.roleName);
        }
    });
}());





